import request from '@/utils/request';

// 报表相关接口

export function fetchReportList(params) {
  return request({
    url: '/api/report/list',
    method: 'get',
    params,
  });
}

export function fetchReportDetail(id) {
  return request({
    url: `/api/report/detail/${id}`,
    method: 'get',
  });
}

export function createReport(data) {
  return request({
    url: '/api/report',
    method: 'post',
    data,
  });
}

export function updateReport(id, data) {
  return request({
    url: `/api/report/${id}`,
    method: 'put',
    data,
  });
}

export function deleteReport(id) {
  return request({
    url: `/api/report/${id}`,
    method: 'delete',
  });
}

export function exportReport(params) {
  return request({
    url: '/api/report/export',
    method: 'get',
    params,
    responseType: 'blob',
  });
}

export function getReportData(params) {
  return request({
    url: 'http://127.0.0.1:4523/m2/6644726-6352716-default/367810664',
    method: 'get',
    params,
  });
}
export function getReportData2(params) {
  return request({
    url: 'http://127.0.0.1:4523/m2/6644726-6352716-default/360646137',
    method: 'get',
    params,
  });
}

// 保存报表（表头 + 数据）
export function saveReportData(data) {
  return request({
    // 如无后端网关，请将此处替换为你的实际保存接口地址
    url: '/api/report/save',
    method: 'post',
    data,
  });
}


